<template>
	<view class="bg-white ">
		<view>
			<u-alert  type="info" :show-icon="true" :description="description" fontSize="16"></u-alert>
		</view>
		<view class="cu-bar bg-white solid-bottom  text-xl">
			<view class="action">
				<text class="cuIcon-titles text-blue"></text>
				请填写错误信息
			</view>
		</view>
		<view class="bg-white padding">
			<u-form labelPosition="top" :model="fix" ref="uFrom" :rules="rules" :labelWidth="180">
				<u-form-item label="错误信息" prop="content" required>
					<u-textarea  v-model="fix.content" placeholder="请详细描述您发现的问题" confirmType="done" count maxlength="500"></u-textarea>
				</u-form-item>
			</u-form>
			<view class="padding">
				<button class="cu-btn block bg-blue margin-tb-sm lg round" @click="submit()">确认反馈</button>
			</view>
		</view>
		
	</view>
</template>

<script>
	import { qbmsQuestionFixSave } from "@/api/qbms.js";
	export default {
		data() {
			return {
				description: "提交错误信息，经核实正确后将收到科研之家小周边哦！",
				questionId: 0, // 题目ID
				fix: {
					content: "",
				}, // 纠错表单
				rules: {
					content: {
						type: 'string',
						min: 5,
						required: true,
						message: '请用5个以上的文字描述',
						trigger: ['change']
					},
					
				}
			}
		},
		onLoad(options) {
			this.questionId = options.questionId
		},
		methods: {
			submit() {
				let that = this;
				this.$refs.uFrom.validate().then(res => {
					this.$util.$confirm("是否确认提交？").then(res => {
						that.confirm();
					})
				}).catch(err => {
					
				})
			},
			confirm() {
				qbmsQuestionFixSave({
					questionId: this.questionId,
					content: this.fix.content
				}).then(res => {
					this.$util.$navigateBack(res.msg)
				})
			}
		}
	}
</script>

<style>

</style>
